當我們網頁建立了基本的authentcation,接著就能開始建立我們的功能,首先在web上的html 建立input tag(利用kendo ui)
<kendo-textbox-container floatingLabel="message">
<input kendoTextBox id="coachMessage" [min]="0" type="text" required />
</kendo-textbox-container>
<button kendoButton (click)="editedValueSent()">確認</button>
<button kendoButton (click)="editedValueCancel()">取消</button>
再於ts檔中建立把text傳至firebase
async editedValueSent(){
this.braceletDataEditorVisible = false;
const peopleId = (document.getElementById('editorId') as HTMLInputElement).value;
await this.accountService.addCoachMessage(peopleId,message)
}
editedValueCancel(){
this.braceletDataEditorVisible = false;
}
accountService.ts
async addCoachMessage(peopleId,message){
const firebaseId = firebase.auth().currentUser.uid
const data = {
coachMessage:message
};
console.log(data)
await this.db.collection('personal-accounts').doc(firebaseId).collection('peoples').doc(peopleId).update(data)
}
當寫入firebase再利用googleHomeTrigger 藉由onChange進行傳遞訊息